﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Entity.Migrations;
using CollegeApp.DataModels;

namespace CollegeApp.Data
{
    public static class Seeder
    {
        public static void Seed(
            ApplicationDbContext db,
            bool seedColleges = true,
            bool seedReviews = true

            )
        {
            if (seedColleges)
            {
                //seed Colleges
                db.Colleges.AddOrUpdate(
                   p => p.Name,
                   new College { Name = "The Big League", Image = "http://www.fbnstatic.com/static/managed/img/fb2/news/college-campus-students.jpg" },
                   new College { Name = "Some College", Image = "http://media.treehugger.com/assets/images/2011/10/green-college-campus.jpg.644x0_q100_crop-smart.jpg" },
                   new College { Name = "Round House", Image = "" },
                   new College { Name = "School Of Rock", Image = "http://colleges.usnews.rankingsandreviews.com/img/college-photo_4810..jpg" }
                    );
                db.SaveChanges(); 
            }
            if (seedReviews)
            {
                //seed Reviews
                db.Reviews.AddOrUpdate(
                    p => p.Title,
                    new Review { Title = "The Big @#$!", Comment = "I don't think they'll last", CollegeId = 1, Rate = Rating.Poor },
                    new Review { Title = "I think some more", Comment = "Love the extra-cirriculum", CollegeId = 2, Rate = Rating.Average },
                    new Review { Title = "I love Kung-Fu", Comment = "They teach American Karate, not Kung-Fu!", CollegeId = 3, Rate = Rating.Fair },
                    new Review { Title = "You guessed it", Comment = "This school rocks!", CollegeId = 4, Rate = Rating.Excellent }
                    );
                db.SaveChanges();
            }



        }
    }
}
